package net.aiform.template.pojo;

import java.io.Serializable;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import net.aiform.pojo.Identity;

@Entity
@Table(name = "af_field")
public class Field extends Identity implements Serializable {
	private static final long serialVersionUID = -3572304584772845130L;
	private String category;
	private int length;
	private int position;
	private String defaultValue;
	private String exampleValue;
	private String restrain;
	private String restrainRemark;
	@OneToMany(mappedBy = "field", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	private Set<Option> options;
	private boolean hidden;
	@ManyToOne(cascade = CascadeType.REFRESH, optional = false)
	@JoinColumn(name = "template", referencedColumnName = "id")
	private Template template;

	public String getDefaultValue() {
		return defaultValue;
	}

	public String getExampleValue() {
		return exampleValue;
	}

	public Set<Option> getOptions() {
		return options;
	}

	public String getRestrain() {
		return restrain;
	}

	public boolean isHidden() {
		return hidden;
	}

	public void setDefaultValue(String defaultValue) {
		this.defaultValue = defaultValue;
	}

	public void setExampleValue(String exampleValue) {
		this.exampleValue = exampleValue;
	}

	public void setHidden(boolean hidden) {
		this.hidden = hidden;
	}

	public void setOptions(Set<Option> options) {
		this.options = options;
	}

	public void setRestrain(String restrain) {
		this.restrain = restrain;
	}

	public Template getTemplate() {
		return template;
	}

	public void setTemplate(Template template) {
		this.template = template;
	}

	public String getCategory() {
		return category;
	}

	public void setCategory(String category) {
		this.category = category;
	}

	public int getPosition() {
		return position;
	}

	public void setPosition(int position) {
		this.position = position;
	}

	public int getLength() {
		return length;
	}

	public void setLength(int length) {
		this.length = length;
	}

	public String getRestrainRemark() {
		return restrainRemark;
	}

	public void setRestrainRemark(String restrainRemark) {
		this.restrainRemark = restrainRemark;
	}

}
